package com.weishi.project.sport.trainingdata.controller;

import com.weishi.framework.web.controller.BaseController;
import com.weishi.framework.web.domain.AjaxResult;
import com.weishi.project.sport.trainingdata.service.TrainingDataService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Api(value = "运动员端--训练数据模块", description = "运动员端--训练数据模块")
@RestController
@CrossOrigin("*")//解决移动端跨域
@RequestMapping("/sportTrainingData/")
public class TrainingDataController extends BaseController {


    /**
     * 训练数据模块接口
     */
    @Autowired
    private TrainingDataService trainingDataService;


    @ApiOperation("查询运动员身体准备训练--根据传参-年-查询所有月的统计 ( 按照 分钟 统计 )")
    @RequestMapping(value = "getPrepare", method = RequestMethod.POST)
    @ResponseBody
    public AjaxResult getPrepare(String years)
    {
        return trainingDataService.getPrepare(years);
    }


    @ApiOperation("查询运动员水上专项训练--最好成绩排名")
    @RequestMapping(value = "getWater", method = RequestMethod.POST)
    @ResponseBody
    public AjaxResult getWater(Integer trainingMode , Integer kilometers , Integer pageNum , Integer pageSize , Integer realClassHour)
    {
        return trainingDataService.getWater(trainingMode , kilometers , pageNum , pageSize , realClassHour);
    }


    @ApiOperation("查询运动员陆上专项训练")
    @RequestMapping(value = "getLand", method = RequestMethod.POST)
    @ResponseBody
    public AjaxResult getLand()
    {
        return trainingDataService.getLand();
    }


    @ApiOperation("查询运动员陆上力量训练")
    @RequestMapping(value = "getLandStrength", method = RequestMethod.POST)
    @ResponseBody
    public AjaxResult getLandStrength()
    {
        return trainingDataService.getLandStrength();
    }


    @ApiOperation("查询运动员--训练结果排名--根据状态查询")
    @RequestMapping(value = "getResultRanking", method = RequestMethod.POST)
    @ResponseBody
    public AjaxResult getResultRanking()
    {
        return trainingDataService.getResultRanking();
    }


    @ApiOperation("查询运动员--训练数据 模块返回值 （  累计 天 ， 距离 ， 水上训练次数 ， 陆上训练次数  ）")
    @RequestMapping(value = "getReturnTrainingDataVO", method = RequestMethod.POST)
    @ResponseBody
    public AjaxResult getReturnTrainingDataVO()
    {
        return trainingDataService.getReturnTrainingDataVO();
    }


    @ApiOperation("查询自然年 列表")
    @RequestMapping(value = "getNaturalYear", method = RequestMethod.POST)
    @ResponseBody
    public AjaxResult getNaturalYear()
    {
        return trainingDataService.getNaturalYear();
    }


    @ApiOperation("查询数据字典主表 -- （ 查询公里数和时间 ）")
    @RequestMapping(value = "getMileageAndTime", method = RequestMethod.POST)
    @ResponseBody
    public AjaxResult getMileageAndTime()
    {
        return trainingDataService.getMileageAndTime();
    }


    @ApiOperation("查询数据字典子表 -- （ 根据主表的类型，查询子表的数据 ）")
    @RequestMapping(value = "getTypeValue", method = RequestMethod.POST)
    @ResponseBody
    public AjaxResult getTypeValue(String types)
    {
        return trainingDataService.getTypeValue(types);
    }


    @ApiOperation("查询运动员水上专项训练--训练距离时间")
    @RequestMapping(value = "getTrainingDistanceTime", method = RequestMethod.POST)
    @ResponseBody
    public AjaxResult getTrainingDistanceTime(String years , Integer trainingMode)
    {
        return trainingDataService.getTrainingDistanceTime(years , trainingMode);
    }






}
